package com.lcxw.hxzbapi.service;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.lcxw.hxzbapi.dao.mapper.YwpdChargeDetailMapper;
import com.lcxw.hxzbapi.entity.pojo.YwpdChargeDetail;

@Component
public class YwpdChargeDetailService {

    @Resource
    YwpdChargeDetailMapper ywpdChargeDetailMapper;

    public int addChargeDetail(YwpdChargeDetail ywpdChargedetail) {
        return ywpdChargeDetailMapper.addChargeDetail(ywpdChargedetail);
    }

    public int deleteByOrderNo(String orderNo) {
        return ywpdChargeDetailMapper.deleteByOrderNo(orderNo);
    }

    public int updateStatusByOrderNo(YwpdChargeDetail ywpdChargedetail) {
        return ywpdChargeDetailMapper.updateStatusByOrderNo(ywpdChargedetail);
    }

    public YwpdChargeDetail selectByOrderNo(String orderNo) {
        return ywpdChargeDetailMapper.selectByOrderNo(orderNo);
    }

    public float selectRmbCount(long userId) {
        return ywpdChargeDetailMapper.selectRmbCount(userId);
    }

    public int selectCoinCount(long userId) {
        int i = ywpdChargeDetailMapper.selectCountDync(userId, null, null, null, "交易成功");
        if (i == 0) {
            return 0;
        }
        return ywpdChargeDetailMapper.selectCoinCount(userId);
    }

    public List<YwpdChargeDetail> selectDync(long userId, String chargeMode, String startTime,
        String endTime, String status, int pageIndex, int pageSize) {
        return ywpdChargeDetailMapper
            .selectDync(userId, chargeMode, startTime, endTime, status, pageIndex, pageSize);
    }

    public int selectCountDync(long userId, String chargeMode, String startTime, String endTime,
        String status) {
        return ywpdChargeDetailMapper
            .selectCountDync(userId, chargeMode, startTime, endTime, status);
    }

    public List<YwpdChargeDetail> selectByUserId(long userId, int pageNum, int pageSize) {
        return ywpdChargeDetailMapper.selectByUserId(userId, pageNum, pageSize);
    }


}
